package com.loobot.album.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * @author: Ike.Fan
 * @date: 2019/3/5.
 */
@Component
@ConfigurationProperties(prefix = "project")
public class ProjectProperties {
    //项目部署的绝对路径
    private String root;
    private String domain;

    public String getRoot() {
        return root;
    }



    public String getMomentPath(){
        return root+ File.separatorChar+"moment"+File.separatorChar;
    }
    /**
     * 获取外部访问url路径
     * @param reltvPath 文件相对路径（相对项目部署root）
     * @return
     */
    public String getOutUrlPath(String reltvPath){
        return domain + reltvPath;
    }

    public void setRoot(String root) {
        this.root = root;
    }


    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }
}
